package Protocoltcp;/*

 */

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.CharsetUtil;

import java.util.UUID;

/**
 * @ClassName MyServerHandler
 * @Author Final
 * @Project DataStructures
 */
public class MyServerHandler extends  SimpleChannelInboundHandler<MessageProtocol> {

    private  int count;


    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, MessageProtocol messageProtocol) throws Exception {
        int len = messageProtocol.getLen();
        byte[] content = messageProtocol.getContent();

        System.out.println("服务器收到信息如下：");
        System.out.println(len+"***********************"+new String(content,CharsetUtil.UTF_8));

        System.out.println("服务器接收数据总量"+(++this.count));
    }
}
